﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Commercial;

public partial class UserControl_BrandManager : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Brand brand = new Brand();
            Repeater_BrandList.DataSource = brand.ListBrand();
            Repeater_BrandList.DataBind();
        }
    }
    protected void Repeater_BrandList_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "delete")
        {
            Brand brand = new Brand();
            brand.DeleteBrand(Convert.ToInt32(e.CommandArgument));
            Response.Redirect("~/quanlythuonghieu.html");
            DateTime.Parse("").ToString("YY-mm-dd");
        }
    }
    protected void Repeater_BrandList_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            Literal status = (Literal)e.Item.FindControl("Literal_Status");
            if (status.Text == "0")
            {
                status.Text = "DN thường";
            }
            else
            {
                status.Text = "DN VIP";
            }

            Literal check = (Literal)e.Item.FindControl("Literal_Check");
            if (check.Text == "0")
            {
                check.Text = "Chờ duyệt";
            }
            else
            {
                check.Text = "Được duyệt";
            }
        }
    }
}